package pl.edu.pw.perg.compinfodb.ui;

import javax.swing.DefaultListSelectionModel;
import javax.swing.ListSelectionModel;

import org.jdesktop.swingx.JXTable;

public class JXSelectionModel extends DefaultListSelectionModel implements
		ListSelectionModel {

	private JXTable table;
	
	public JXSelectionModel(JXTable table) {
		this.table = table;
	}
	
//	@Override
//	public int getAnchorSelectionIndex() {
//		int view = super.getAnchorSelectionIndex();
//		if(view == -1)
//			return -1;
//		return table.convertRowIndexToModel(view);
//	}
	
	public int getModelSelectionIndex() {
		int view = super.getAnchorSelectionIndex();
		if(view == -1)
			return -1;
		return table.convertRowIndexToModel(view);
	}
}
